<?php
namespace Common\Model;
use Common\Common\Model;
class AdminModel extends Model {
    protected $tableName = 'admin';
    protected $tablePrimary = 'name';
//    protected $objectClass = 'Common\Model\ConsumerObject';
    /**
     *通过管理员姓名查找密码
     */
    public function fetchPassword($value){
        $result=$this->where("name='".$value."'")->find();
        return $result['password'];
    }
    public function userPage()
    {
        $page = I('get.p');
        $User = M('Consumer'); // 实例化User对象
        $count      = $User->count();// 查询满足要求的总记录数
        $Page       = new \Think\Page($count,2);
        $show       = $Page->show();
        $list = $User->page($page, 2)->select();
        return array(
            'list' => $list,
            'page' => $show,
        );
    }
}
